package net.huashitong.goodsclass.dao;

import com.sirdc.modules.core.dao.GenericQuery;
import com.sirdc.modules.core.dao.StringDao;
import com.sirdc.modules.utils.StringUtils;
import net.huashitong.goodsclass.entity.GoodsClasses;
import net.huashitong.goodsclass.filter.GoodsClassFilter;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public class GoodsClassesDao extends StringDao<GoodsClasses> {



    public List<GoodsClasses> query(GoodsClassFilter filter)
    {
        GenericQuery query = createQuery("obj");
        if (StringUtils.isNotBlank(filter.getClaName())) {
            query.append(" and obj.claName like :claName");
            query.setParam("claName", StringUtils.getLikewords(filter.getClaName()));
        }
        return query.listResult(filter);

    }

}
